﻿#include <stdio.h>

//main05：类型转换
int main05(void)
{
	char a = 'a';
	int b = a;
	printf("1.输出字符a转成整型后的值：%d\n", b);//97

	float c = 3.14f;
	//3.强制类型转换；
	int d = (int)c;
	printf("2.输出单精度浮点型3.14f转成整型后的值：%d\n", d);//3

	int e = 3;
	//5.隐式类型转换；
	//float f = e;
	//6.强制类型转换；
	float f = (float)e;
	printf("4.输出整型3转成单精度浮点型后的值：%f\n", f);//3.000000

	int g = 10;
	int h = 3;
	printf("5.输出强制类型转换为float后10去除整型3的值：%f\n", (float)g / h);//3.333333
	int i = (float)g / (float)h;
	printf("6.输出两个整型都强制类型转换为float，然后相除得到的值：%d\n", i);//3

	return 0;
}